<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>后台登录</title>
<meta name="author" content="DeathGhost" />
<style>
body{height:100%;background:#16a085;overflow:hidden;}
canvas{z-index:-1;position:absolute;}
</style>
<%@ include file="/jsp/common/commonJs.jsp"%>
<script>
$(document).ready(function() {
  //粒子背景特效
  $('body').particleground({
    dotColor: '#5cbdaa',
    lineColor: '#5cbdaa'
  });
  //验证码
  createCode();
});
function subForm(){
	 //验证码判断
	  var flag=validate();
	  if(!flag){
		  return ;
	  }
	  var username=$("#username").val();
	  var pwd=$("#password").val();
	  if(username=='' || pwd==''){
		  alert("用户名或密码不能为空!");
		  return;
	  }
	  var options = {
			url : "${path}/index/login.do",
			type : "post",
			dataType : "json",
			success : function(data){
				if(data.status){
					window.location.href="${path}/productinfo/selectAllInfo.do";
				}else{
					alert("用户名或密码错误!");
				}
			}
	};
	//异步上传图片
	$("#form1").ajaxSubmit(options);
	  /* location.href="${path}/index/login.do"; */
}

	//回车登录
	/* $(document).ready(function() {
		$(".submit_btn").keydown(function(e) {
			var curKey = e.which;
			if (curKey == 13) {
				subForm();
				return false;
			}
		});
	}); */
	document.onkeydown=function(event){ 
		e = event ? event :(window.event ? window.event : null); 
		if(e.keyCode==13){ 
		//执行的方法 
		subForm();
		//alert('回车检测到了'); 
		}
	};
</script>
</head>
<body>
<form id="form1" method="post">
<dl class="admin_login">
 <dt>
  <strong>dotnet2后台管理系统</strong>
  <em>Dotnet2-Web Management System</em>
 </dt>
 <dd class="user_icon">
  <input type="text" id="username" placeholder="账号" class="login_txtbx" name="username" value="admin"/>
 </dd>
 <dd class="pwd_icon">
  <input type="password" id="password" placeholder="密码" class="login_txtbx" name="password" value="123456" />
 </dd>
 <dd class="val_icon">
  <div class="checkcode">
    <input type="text" id="J_codetext" placeholder="验证码" maxlength="4" class="login_txtbx">
    <canvas class="J_codeimg" id="myCanvas" onclick="createCode()">对不起，您的浏览器不支持canvas，请下载最新版浏览器!</canvas>
  </div>
  <input type="button" value="验证码核验" class="ver_btn" onClick="validate();">
 </dd>
 <dd>
  <input type="button" value="立即登陆" onclick="subForm()" class="submit_btn"/>
 </dd>
 <dd>
  <p>Copyright © 2004-2014 CCHVC云通-CDN全业务平台版权所有</p>
  <p>京ICP备14002150号-1 京公网安备1101080213237号</p>
 </dd>
</dl>
</form>
</body>
</html>
